package parser.graph;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlIDREF;
import javax.xml.bind.annotation.XmlRootElement;

import smarties.SmartEdge;

/**
 * Permet de charger un arc.
 * 
 * @author buthane
 */
@XmlRootElement(name = "edge")
public class SmartEdgeParser
{
	private static int		instanceCount	= 0;

	private final SmartEdge	edge			= new SmartEdge(null, null);

	public static int getInstanceCount()
	{
		return SmartEdgeParser.instanceCount;
	}

	@XmlElement(name = "from")
	@XmlIDREF
	public SmartNodeParser getFrom()
	{
		return null;
	}

	public void setFrom(SmartNodeParser from)
	{
		this.edge.from = from.getSmartNode();
	}

	@XmlElement(name = "to")
	@XmlIDREF
	public SmartNodeParser getTo()
	{
		return null;
	}

	public void setTo(SmartNodeParser from)
	{
		this.edge.to = from.getSmartNode();
	}

	public SmartEdge getSmartEdge()
	{
		return this.edge;
	}

	public SmartEdgeParser()
	{
		SmartEdgeParser.instanceCount++;
	}

	@Override
	public String toString()
	{
		return "Smart edge parser (from : " + this.edge.from + " -> to : "
				+ this.edge.to;
	}

}
